<?php 
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
$info = pdo_get('snx_articles',array('id'=>$_GPC['id']));
if (checksubmit('submit')) {
	$data['title'] = $_GPC['title'];
	$data['thumb'] = $_GPC['thumb'];
	$data['content'] = html_entity_decode($_GPC['content']);
    $data['author'] = $_GPC['author'];
    $data['state'] = 1;
	$data['create_time'] = date('Y-m-d H:i:s',time());
    $data['uniacid']=$_W['uniacid'];
	if($_GPC['id']==''){  
        $rst=pdo_insert('snx_articles',$data);      
        if($rst){
             message('添加成功！', $this->createWebUrl('articles'), 'success');
        }else{
             message('添加失败！','','error');
        }
    }else{
         $rst=pdo_update('snx_articles',$data,array('id'=>$_GPC['id']));
        if($rst){
             message('编辑成功！', $this->createWebUrl('articles'), 'success');
        }else{
             message('编辑失败！','','error');
        }
    }
}
include $this->template('web/addarticles');
 ?>